import {
  // 语法提示
  defineConfig, loadEnv
} from "vite";

import viteProdConfig from "./vite.prod.config";
import viteDevConfig from "./vite.dev.config";
import viteBaseConfig from "./vite.base.config";

const envResolver = {
  // 生产环境
  "build": () => ({ ...viteBaseConfig, ...viteProdConfig }),
  // 开发环境
  "serve": () => ({ ...viteBaseConfig, ...viteDevConfig })
};

export default defineConfig(({ command, mode }) => {
  return envResolver[command]();
});